package com.huluobo.appbase.utils

import android.content.Context
import android.content.res.Resources
import android.util.TypedValue

/**
 * Created by lc on 2023/3/2.
 * dp转px的工具
 */
object DeviceUtil {
    fun dp2px(context: Context, dpValue: Float): Int {
        val r: Resources = context.applicationContext.resources
        return TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, dpValue, r.displayMetrics
        ).toInt()
    }
}